<?php

namespace app\shop\model;

class Worktype extends \ShopModel
{
    protected $table = 'sh_crm_report_type';
    public function newtype($data){
        $res=$this->insertGetId($data);
        return $res;
    }
    public function checktitle($title){
        $has=$this->where(["title"=>$title])->find();
        if($has)
            return 1;
        else 
            return 0;
    }
    public function getlist(){
        return $this->where(["is_delete"=>0])->field("type_id,title")->select();
    }
    public function delbyid($id){
        return $this->where("type_id=$id")->delete();
    }
    public function updatebyid($id,$title){
        return $this->where("type_id=$id")->update(["title"=>$title]);
    }
}
